package com.syyo.gulimall.product.web;

import com.syyo.gulimall.product.domain.vo.SkuItemVo;
import com.syyo.gulimall.product.service.SkuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @ author:  wang
 * @ date: 2021/3/25 10:01
 * @ Description: 商品详情
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;


    @GetMapping({"/{skuId}.html"})
    public String indexPage(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println("查询商品详情" + skuId);

        SkuItemVo item = skuInfoService.item(skuId);
        model.addAttribute("item", item);
        return "item";
    }


}
